<?php
/**
 *   Joomdiet - administrator/components/controller.php
 *   Author: Juan Dapena Paz (juan@bittingbits.com)
 *   Copyright (C) 2010 Bitting Bits S.L.
 *
 *   This program is free software: you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation, either version 3 of the License, or
 *   (at your option) any later version.
 *
 *   This program is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *   GNU General Public License for more details.
 *
 *   You should have received a copy of the GNU General Public License
 *   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

// no direct access
defined('_JEXEC') or die('Restricted access');

jimport( 'joomla.application.component.controller' );
require_once( JPATH_COMPONENT.DS.'helpers'.DS.'helper.php' );

/**
 * joomdiet Controller
 *
 * @package Joomla
 * @subpackage joomdiet
 */
class JoomdietController extends JController {
    /**
     * Constructor
     * @access private
     * @subpackage joomdiet
     */
    function __construct() {
        //Get View
        if(JRequest::getCmd('view') == '') {
            JRequest::setVar('view', 'default');
        }
        $this->item_type = 'Default';
        parent::__construct();
    }
    
    function fooddatabase()
    {
        JRequest::setVar('view', 'food');
        parent::display();
    }
    
    function recipedatabase()
    {
        JRequest::setVar('view', 'recipe');
        parent::display();
    }
    
    function variables()
    {
        JRequest::setVar('view', 'variable');
        parent::display();
    }
    
    function foodcategories()
    {
        JRequest::setVar('view', 'foodcategories');
        parent::display();
    }
    
    function recipecategories()
    {
        JRequest::setVar('view', 'recipecategories');
        parent::display();
    }
    
    function physicalactivity()
    {
        $view =& $this->getView('physicalactivity', 'html');
        
        $view->setModel($this->getModel('physicalactivity'), true);
        
        $view->display();
    }
    
    function importdata()
    {
        JRequest::setVar('view', 'importdata');
        parent::display();
    }
    
    
}
?>
